package com.zuokun.manager;

import com.zuokun.vo.RoomInfo;

import java.util.HashMap;
import java.util.Map;

/**
 * @author blueCat
 * @date 2025/7/7 18:05
 * @motto life is a gift
 */
public class RoomManager {

    private static Integer maxId = 0;

    public static Map<Integer, RoomInfo> roomMap = new HashMap<>();

    /**
     * 获取房间
     *
     * @param id
     * @return
     */
    public static RoomInfo getRoom(Integer id) {
        return roomMap.get(id);
    }

    /**
     * 新增房间
     *
     * @return
     */
    public static RoomInfo addRoom() {
        RoomInfo room = new RoomInfo();
        //设置房间id
        room.setId(maxId++);
        //将房间加入map集合
        roomMap.put(room.getId(), room);
        return room;
    }

    /**
     * 移除房间
     *
     * @param id
     */
    public static void removeRoom(Integer id) {
        roomMap.remove(id);
    }
}
